import request from '@/utils/request'

export function provinceRegionCount(query) {
  return request({
    url: '/ops/dashboard/provinceRegionCount',
    method: 'post',
    params: query
  })
}

export function refreshToken(query) {
  return request({
    url: '/ops/dashboard/refreshToken',
    method: 'post',
    params: query
  })
}

export function regionCount(query) {
  return request({
    url: '/ops/dashboard/regionCount',
    method: 'post',
    params: query
  })
}

export function regionRank(query) {
  return request({
    url: '/ops/dashboard/regionRank',
    method: 'post',
    params: query
  })
}

export function equipmentRunCount(query) {
  return request({
    url: '/ops/dashboard/runCount',
    method: 'post',
    params: query
  })
}

export function equipmentAlarmCount(query) {
  return request({
    url: '/ops/dashboard/alarmCount',
    method: 'post',
    params: query
  })
}

export function equipmentAlarmPage(query) {
  return request({
    url: '/ops/dashboard/alarmPage',
    method: 'post',
    params: query
  })
}

export function alarmCategoryCount(query) {
  return request({
    url: '/ops/dashboard/alarmCategoryCount',
    method: 'post',
    params: query
  })
}

export function alarmCountGroupByProvince(query) {
  return request({
    url: '/ops/dashboard/alarmCountGroupByProvince',
    method: 'post',
    params: query
  })
}

export function selectRegionList(query) {
  return request({
    url: '/ops/dashboard/regionList',
    method: 'post',
    params: query
  })
}

export function selectRegionPage(query) {
  return request({
    url: '/ops/dashboard/regionPage',
    method: 'post',
    params: query
  })
}

export function selectEquipmentRecord(query) {
  return request({
    url: '/ops/dashboard/selectEquipmentRecord',
    method: 'post',
    params: query
  })
}

export function selectZoneByRegionId(query) {
  return request({
    url: '/ops/dashboard/selectZoneByRegionId',
    method: 'post',
    params: query
  })
}

export function selectEquipmentByIMEI(query) {
  return request({
    url: '/ops/dashboard/selectEquipmentByIMEI',
    method: 'post',
    params: query
  })
}

export function selectEquipmentRecordByIMEI(query) {
  return request({
    // url: '/ops/dashboard/selectEquipmentRecordByIMEI',
    url: '/ops/dashboard/selectEquipmentRecordByZoneId',
    method: 'post',
    params: query
  })
}

export function selectEquipmentAlarmPageByRegionId(query) {
  return request({
    url: '/ops/dashboard/selectEquipmentAlarmPageByRegionId',
    method: 'post',
    params: query
  })
}

export function selectEquipmentAlarmByIMEI(query) {
  return request({
    url: '/ops/dashboard/selectEquipmentAlarmByIMEI',
    method: 'post',
    params: query
  })
}

// 下水道弹窗数据
export function getWaterGutterRecord(query) {
  return request({
    url: '/ops/dashboard/getWaterGutterRecord',
    method: 'get',
    params: query
  })
}

/**
 * 删除设备类型
 * @param data
 * @returns {*}
 */
export function selectZoneById(data) {
  return request({
    url: '/ops/dashboard/selectZone/' + data,
    method: 'post'
  })
}

// 服务站数量的接口
export function getServiceStationCount(query) {
  return request({
    url: '/ops/ai/community/service/station/serviceStation/count',
    method: 'get',
    params: query
  })
}

// 物联项目数量的接口
export function getIotProjectCount(query) {
  return request({
    url: '/ops/ai/community/service/station/iotProject/count',
    method: 'get',
    params: query
  })
}
// 设备总数的接口
export function getDeviceCount(query) {
  return request({
    url: '/ops/ai/community/service/station/device/count',
    method: 'get',
    params: query
  })
}
// 告警设备数的接口
export function getAlarmDeviceCount(query) {
  return request({
    url: '/ops/ai/community/service/station/alarmDevice/count',
    method: 'get',
    params: query
  })
}

// 设备告警列表的接口
export function selectAlarmPageByRegionId(query) {
  return request({
    url: '/ops/robot/alarm/selectAlarmPageByRegionId',
    method: 'post',
    params: query
  })
}

// 能耗态势的接口
export function getEnergySituation(query) {
  return request({
    url: '/ops/ai/community/service/station/energy/consumption/situation',
    method: 'get',
    params: query
  })
}
// export function selectAlarmPageByRegionId(query) {
//   return request({
//     url: '/ops/ai/community/service/station/energy/consumption/situation',
//     method: 'post',
//     params: query
//   })
// }

/**
 * 全屏
 */
export function launchFullscreen() {
  let element = document.documentElement
  if (element.requestFullscreencreen) {
    element.requestFullScreen()
  } else if (element.mozRequestFullScreen) {
    element.mozRequestFullScreen()
  } else if (element.webkitRequestFullScreen) {
    element.webkitRequestFullScreen()
  } else if (element.msRequestFullScreen) {
    element.msRequestFullScreen()
  }
}

/**
 *阻止鼠标右键
 */
export function stopContextmenu() {
  document.oncontextmenu = function () {
    return false
  }
}

/**
 * 组织F5刷新
 */
export function stopF5Refresh() {
  document.onkeydown = function (e) {
    let evt = window.event || e
    let code = evt.keyCode || evt.which
    if (code == 116) {
      launchFullscreen()
      if (evt.preventDefault) {
        evt.preventDefault()
      } else {
        evt.keyCode = 0
        evt.returnValue = false
      }
    }
  }
}








